/**
 * 功能描述: 加载中样式表
 * @author 崔孝楠
 * @date 2022/10/8 8:37
 * @version 1.0
 */
@import '../../style/index';

// loading 布局
@mixin loading--layout {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  position: static;
  display: inline-block;
  text-align: center;
  vertical-align: middle;
}

// loading 图形中 点的布局
@mixin loading-dot-item--layout {
  position: absolute;
  display: block;
  width: 9px;
  height: 9px;
  transform: scale(.75);
  transform-origin: 50% 50%;
}

// loading旋转点 第二个子元素动画
@mixin loading-dot-second-child--layout {
  top: 0;
  right: 0;
}

// loading旋转点 第三个子元素动画
@mixin loading-dot-third-child--layout {
  right: 0;
  bottom: 0;
}

// loading旋转点 第四个子元素动画
@mixin loading-dot-fourth-child--layout {
  bottom: 0;
  left: 0;
}

// loading 遮罩的内容布局
@mixin  loading-blur--layout {
  position: relative;
  clear: both;
}

// large size 大小
@mixin loading-lg--layout {
  @include b(loading-dot-item) {
    width: 14px;
    height: 14px;
  }
}

// large size 大小
@mixin loading-sm--layout {
  @include b(loading-dot-item) {
    width: 6px;
    height: 6px;
  }
}

// 描述文字布局
@mixin loading-text--layout {
  position: absolute;
  top: 50%;
  width: 100%;
  padding-top: 5px;
}

// loading 样式
@include b(loading) {
  font-size: $font-size-base;
  font-variant: tabular-nums;
  list-style: none;
  font-feature-settings: "tnum";
  opacity: 1;
  @include loading--layout;
}

// loading 旋转动画
@include b(loading-dot-spin) {
  transform: rotate(45deg);
  -webkit-animation: loadingRotate 1.2s infinite linear;
  animation: loadingRotate 1.2s infinite linear;
}

// 旋转动画
@-webkit-keyframes loadingRotate {
  to {
    transform: rotate(405deg);
  }
}
// 旋转动画
@keyframes loadingRotate {
  to {
    transform: rotate(405deg);
  }
}

// loading 图形的布局
@include b(loading-dot) {
  position: relative;
  display: inline-block;
  font-size: 20px;
  width: 1em;
  height: 1em;
}

// loading 图形中 点的样式
@include b(loading-dot-item) {
  background-color: $color-primary;
  border-radius: 100%;
  opacity: .3;
  -webkit-animation: loadingSpinMove 1s infinite linear alternate;
  animation: loadingSpinMove 1s infinite linear alternate;
  @include loading-dot-item--layout;
}

// 颜色动画
@-webkit-keyframes loadingSpinMove {
  to {
    opacity: 1;
  }
}
// 颜色动画
@keyframes loadingSpinMove {
  to {
    opacity: 1;
  }
}

// loading旋转点 第二个子元素动画
.#{$namespace}-loading-dot-item:nth-child(2) {
  -webkit-animation-delay: .4s;
  animation-delay: .4s;
  @include loading-dot-second-child--layout;
}

// loading旋转点 第三个子元素动画
.#{$namespace}-loading-dot-item:nth-child(3) {
  -webkit-animation-delay: .8s;
  animation-delay: .8s;
  @include loading-dot-third-child--layout;
}

// loading旋转点 第四个子元素动画
.#{$namespace}-loading-dot-item:nth-child(4) {
  -webkit-animation-delay: 1.2s;
  animation-delay: 1.2s;
  @include loading-dot-fourth-child--layout;
}

// large size
@include b(loading-lg) {
  // loading 文字大小
  @include b(loading-dot) {
    font-size: 32px;
  }
  @include loading-lg--layout;
}

// small size
@include b(loading-sm) {
  // loading 文字大小
  @include b(loading-dot) {
    font-size: 14px;
  }
  @include loading-sm--layout;
}

// 遮罩层布局
@include b(loading-nested) {
  position: relative;
  // loading 布局
  @include b(loading) {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-height: 400px;
  }
  // loading 形状布局
  @include b(loading-dot) {
    position: absolute;
    top: 50%;
    left: 50%;
    margin: -10px;
  }
}

// loading 遮罩的内容样式
@include b(loading-blur) {
  opacity: .5;
  pointer-events: none;
  @include loading-blur--layout;
}

// 带有描述文字时 loading图形布局
@include b(loading-show-text) {
  @include b(loading-dot) {
    margin-top: -20px;
  }
}

// 描述文字样式
@include b(loading-text) {
  color: $color-primary;
  text-shadow: 0 1px 2px #fff;
  @include loading-text--layout;
}
